"""
封装：将类的属性和方法变为私有
__  表示私有

私有成员变量、方法无法被类对象使用
"""


class Student:
    name = None
    age = None

    # 私有的成员变量
    __id_number = 123

    # 私有方法
    def __set_id(self):
        print(self.__id_number)

    def get_id(self):
        return self.__id_number

    def set_id(self):
        print(f"当前id为：{self.__id_number}，设置为110")
        self.__id_number = 110
        print(self.__id_number)
        print(f"设置后id为：{self.__id_number}")


if __name__ == '__main__':
    stu = Student()
    print(stu.get_id())  # 123

    stu.set_id()
